package net.tngou.iask.service;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.mysql.fabric.xmlrpc.base.Array;

import net.tngou.iask.jdbc.OrderType;
import net.tngou.iask.pojo.Health;

/**
 * 健康档案
 * @author tngou@tngou.net
 *
 */
public class HealthService extends BaseService {

	/**
	 * 取得分组
	 * @param patient
	 * @return
	 */
	public Map<String, List<Health>> getList(long patient) {
		Map<String, List<Health>> map = new HashMap<String, List<Health>>();
		List<Health> list = (List<Health>) getList("patient="+patient, "question", OrderType.ASC, Health.class);
		for (int i = 0; i < list.size(); i++) {
			Health health=list.get(0);
			List<Health> l =map.get(health.getQuestion()+"");
			if(l==null)l = new ArrayList<Health>();
			l.add(health);
			map.put(health.getQuestion()+"", l);
			list.remove(0);
		}
		return map;
	}
}
